//Import needed code
import java.util.ArrayList;
import java.awt.Point;

//The move class represents exactly how a piece moved during a turn
//It holds the location of each spot the piece moved to in an arraylist,
//and also has a related arraylist with boolean values saying if a jump
//occurred during the corresponding location change.
public class Move{
	public ArrayList<Location> locations; //List of locations the piece moves to
	boolean hitMine;  //True if the piece hit a mine and needs to be removed
	boolean transformToKing; //true if checker reached other end of board and transforms to a king

	//First Constructor
	public Move(ArrayList<Point> points, ArrayList<Integer> boards, boolean mineHit, boolean kingTransform)
	{
		//initialize the ArrayList with the size of the ArrayList passed
		locations = new ArrayList<Location>(points.size());

		//Check flag to see if checker should be made to king
		if(kingTransform)
			transformToKing = true;
		else
			transformToKing = false;
		//Check to see if mine was hit..
		if(mineHit)
			hitMine = true;
		else
			hitMine = false;

		//Combine the first two ArrayList arguments to form Locations
		//And set jump ArrayList to the values passed
		for (int i = 0; i < points.size(); i++)
		{
			//Create new temp Location object to store the combined first and second args
			Location temp = new Location(points.get(i).x, points.get(i).y, boards.get(i));
			//Add the temp Location to the Move's locations ArrayList
			locations.add(i, temp);


		}
	}

	//Second Constructor
	public Move(ArrayList<Location> points, boolean mineHit, boolean kingTransform)
	{
		//initialize the ArrayList with the size of the ArrayList passed
		locations = new ArrayList<Location>(points.size());
		//Copy the values from the arguments to Move's ArrayLists

		//Check flag to see if checker should be made to king
		if(kingTransform)
			transformToKing = true;
		else
			transformToKing = false;

		//Check to see if mine was hit..
		if(mineHit)
			hitMine = true;
		else
			hitMine = false;

		for (int i = 0; i < points.size(); i++)
		{
			//Copy to locations
			locations.add(i, points.get(i));
		}
	}

	//Third Constructor
	public Move(ArrayList<Point> points, ArrayList<Integer> boards)
	{
		//initialize the ArrayList with the size of the ArrayList passed
		locations = new ArrayList<Location>(points.size());

		//Assume if not specified that mines werent hit and end of board wasnt reached by a Checker
			transformToKing = false;
			hitMine = false;

		//Combine the first two ArrayList arguments to form Locations
		//And set jump ArrayList to the values passed
		for (int i = 0; i < points.size(); i++)
		{
			//Create new temp Location object to store the combined first and second args
			Location temp = new Location(points.get(i).x, points.get(i).y, boards.get(i));
			//Add the temp Location to the Move's locations ArrayList
			locations.add(i, temp);


		}
	}

	//Accessor method to return the Location ArrayList
	ArrayList<Location> getLocations()
	{
		return locations;
	}

}